/*
 * Author Vinh Nguyen
 */

//package com.restfb.example;

import static java.lang.System.out;

import java.util.Date;
import java.util.List;

import com.restfb.FacebookClient;
import com.restfb.types.User;
import com.restfb.types.Photo;
import com.restfb.types.Video;

 
public class FBUser {
	
	private final FacebookClient facebookClient;
	private User user;
	
	public FBUser(FacebookClient _facebookClient){
		this.facebookClient = _facebookClient;
		this.user = facebookClient.fetchObject("me", User.class);
	}
	
	public String getID(){
		return user.getId();
	} 
	
	public String getName(){
		return user.getName();
	} 
	
	public String getBirthday(){
		return user.getBirthday();
	} 
	
	public Date getBirthdayAsDate(){
		return user.getBirthdayAsDate();
	} 
	
	public String getLocation(){
		return user.getLocation().getName();
	} 
	
	public List<User> getFriendList(){
		return facebookClient.fetchConnection("me/friends", User.class).getData();
	}
	
	public List<Photo> getPhotos(){
		return facebookClient.fetchConnection("me/photos", Photo.class).getData();
	}
	
	public List<Video> getVideo(){
		return facebookClient.fetchConnection("me/videos", Video.class).getData();
	}
	/*
	void Test(){
		List<User> friends = this.getFriendList();
		out.println("My name is " + this.getName() + ". I have " + friends.size() + " friends");
		out.println("Here is list of my friends");
		String tmp = "";
		int i = 0;
		for(User u : friends){
			tmp += u.getName() + " | ";
			if(++i%8 ==0)
				tmp += "\n";
		} 
		out.println(tmp);
		List<Photo> photos = this.getPhotos();
		tmp = "My photos \n";
		for(Photo p : photos){
			tmp += p.getId() + " | ";
		}
		out.println(tmp);
		List<Video> videos = this.getVideo();
		tmp = "My Videos \n";
		for(Video v : videos){
			tmp += v.getId() + " | ";
		}
		out.println(tmp);
	}*/
}
